package yu.code.yurpc.retry;

import yu.code.yurpc.spi.MySpiLoader;
import yu.code.yurpc.tolerant.FailFastTolerantStrategy;
import yu.code.yurpc.tolerant.TolerantStrategy;

/**
 * 重试策略工厂
 */
public class RetryStrategyFactory {
    static {
        MySpiLoader.load(RetryStrategy.class);
    }

    /**
     * 默认重试策略
     */
    public static final RetryStrategy DEFAULT_RETRY_STRATEGY = new NoRetryStrategy();

    public static RetryStrategy getInstance(String key) {
        return MySpiLoader.getInstance(key, RetryStrategy.class);
    }
}
